home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Diamond Collection / The Diamond Collection (Software Vault)(Digital Impact).ISO / cdr44 / speller2.zip / XMM.H < prev    next >
C/C++ Source or Header  |  1995-02-06  |  1KB  |  60 lines

  1. #if !defined(_XMSARRAY_H)
  2. #define _XMSARRAY_H
  3.  
  4. #define BYTE unsigned char
  5. #define WORD unsigned int
  6.  
  7.  
  8.  
  9. #define BAD_PAGE 0xFFFF                /* set to invalid page ID            */
  10.  
  11. #define PageSize 4096
  12.  
  13. class LRU
  14. {
  15.   public:
  16.   LRU(int pages = 4 );
  17.   ~LRU();
  18. int search(WORD page_id, WORD *buffer);
  19. void update(WORD node);
  20. void fifo_reset();
  21.    protected:
  22.   int n_pages;     // pages in cache
  23.   int list_head;
  24.    struct fifo_queue
  25.    {
  26.    WORD succ;                          /* index of next younger node        */
  27.    WORD pred;                          /* index of next older node          */
  28.    BYTE dirty_bit;                     /* TRUE if page has been written to  */
  29.    WORD page_id;                       /* ID of page associated w/this node */
  30.    WORD page_off;
  31.    };
  32.    fifo_queue *lru_fifo;
  33. };
  34.  
  35. class xms  :public LRU
  36. {
  37. public:
  38.  
  39. char far *buffer;
  40.     unsigned int handle;    /* EMB handle allocated */
  41.     long curblock;
  42.      unsigned int CacheSize;
  43.      long size;
  44.      unsigned mask;
  45.     unsigned int error;    /* error code returned be most routines */
  46.     long page;
  47.     unsigned int offset;
  48.     xms(long size,unsigned int &,int pages = 4 );
  49.     ~xms();
  50. void *at(const long index);
  51. void *ats(const long index);
  52.     int valid() { return state;}
  53. protected:
  54.     int state;
  55.      unsigned int XMSsize;
  56.  
  57. };
  58.  
  59. #endif
  60.